<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery-1.12.4.min.js"></script>
    <script>
        $(function(){
            var my_div_1 = $('div').has('#mytext')
            // 对当前的对象设置css
            my_div_1.css({'background' : 'red'})
        })

        $(function(){
            var my_ul = $('ul li').eq(0);
            my_ul.css({'background' : 'green'})
        })
    </script>
</head>
<body>
    <div>
        这是第一个div
        <input type="text" id="mytext">
    </div>
    <div>
        这是第二个div
        <input type="text">
        <input type="button" value="点击">
    </div>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
</body>
</html>